<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" />
<xsl:template match="/">using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Xml;
using System.Reflection;
using System.Configuration;
using ESpace.DALibrary.SqlServer;
using ESpace.DALibrary;

namespace <xsl:value-of select="Schema/@NameSpace" />
{
	<xsl:if test="Schema/@IsInternal='True'">internal</xsl:if><xsl:if test="Schema/@IsInternal='False'">public</xsl:if> class <xsl:value-of select="Schema/@StoreProcedureName" /> : DataAccessBase
	{
		public <xsl:value-of select="Schema/@StoreProcedureName" />()
		{
			base.EncryptMethod = Alogrim.SymmProvEnum.<xsl:value-of select="Schema/@EncryptMethod" />;
			base.Key = "<xsl:value-of select="Schema/@Key" />";
			base.IV = "<xsl:value-of select="Schema/@IV" />";
			ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["<xsl:value-of select="Schema/@DBName" />"] == null ? "" : System.Configuration.ConfigurationManager.ConnectionStrings["<xsl:value-of select="Schema/@DBName" />"].ConnectionString;
			base.InitCommand("<xsl:value-of select="concat('[',Schema/@Owner,'].[',Schema/@StoreProcedureName,']')" />");
			ConfigParameter();
		}
<xsl:for-each select="Schema/Columns">
		private SqlParameter param<xsl:value-of select="ParameterName" />;
		public <xsl:value-of select="concat(LanguageType,' ',ParameterName)" />
		{
			get
			{
				return (<xsl:value-of select="LanguageType" />)param<xsl:value-of select="ParameterName" />.Value;
			}
			set
			{
				param<xsl:value-of select="ParameterName" />.Value = value;
			}
		}
</xsl:for-each>
		public void ConfigParameter()
		{<xsl:for-each select="Schema/Columns">
			//--------------------------------------------------------
			param<xsl:value-of select="ParameterName" /> = new SqlParameter();
			param<xsl:value-of select="ParameterName" />.ParameterName = "@<xsl:value-of select="ParameterName" />";
			param<xsl:value-of select="ParameterName" />.SqlDbType = <xsl:value-of select="DbType" />;<xsl:if test="IsLengthDef='1'">
			param<xsl:value-of select="ParameterName" />.Size = <xsl:value-of select="MaxLength" />;</xsl:if>
			param<xsl:value-of select="ParameterName" />.Precision = <xsl:value-of select="Precision" />;
			param<xsl:value-of select="ParameterName" />.Scale = <xsl:value-of select="Scale" />;
			param<xsl:value-of select="ParameterName" />.Direction = ParameterDirection.<xsl:choose>
				<xsl:when test="IsOutput='false'">Input</xsl:when>
				<xsl:when test="IsOutput='true'">InputOutput</xsl:when>
			</xsl:choose>;
			param<xsl:value-of select="ParameterName" />.Value = DBNull.Value;
			base.sqlComm.Parameters.Add(this.param<xsl:value-of select="ParameterName" />);</xsl:for-each>
		}
	}
}</xsl:template>
</xsl:stylesheet>